package org.common.utils.rpc;
import org.common.utils.json.JSONTool;
import org.common.utils.rpc.entity.Person;
import org.common.utils.thread.ThreadTool;

import java.util.Map;
import java.util.concurrent.CompletableFuture;

/**
 * @author zhouzhibing
 * @date 2025/11/16 19:54
 */
public class RpcInterfaceTestServerImpl implements RpcInterfaceTest {

    @Override
    public void say0() {
        System.out.println("RpcInterfaceTestServerImpl say0");
    }

    @Override
    public void say1(String message, int age, double score) {
        System.out.println("RpcInterfaceTestServerImpl say1");
//        System.out.println("RpcInterfaceTestServerImpl say1 message = " + message + " age = " + age + " score = " + score);
    }

    @Override
    public String say2(String message, Person person) {
        System.out.println("RpcInterfaceTestServerImpl say2");
//        String name = null;
//        name.length();
//        person.setAddress("上海");
//        return JSONTool.toJSONString();
        return "rpc server return";
    }

    @Override
    public CompletableFuture<String> say3(String message) {
        System.out.println("RpcInterfaceTestServerImpl say3 " + message);
//        ThreadTool.sleep(1000);
        return CompletableFuture.completedFuture("hello " + message);
    }
}
